package com.itheima_03;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

public class ThreadTest03 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc = new MyCallable();
        FutureTask<String> ft1 = new FutureTask<>(mc);
        FutureTask<String> ft2 = new FutureTask<>(mc);
        Thread t1 = new Thread(ft1);
        t1.setName("线程1");
        Thread t2 = new Thread(ft2);
        t2.setName("线程2");
        t1.start();
        t2.start();
        System.out.println(ft1.get());
        System.out.println(ft2.get());

    }
}
